<template>
  <div class="register">
    <div class="top">
      <div class="title">{{ hospitalStore.hospitalInfo.hospital?.hosname }}</div>
      <div class="level">
        <svg
            t="1685174493331"
            class="icon"
            viewBox="0 0 1024 1024"
            version="1.1"
            xmlns="http://www.w3.org/2000/svg"
            p-id="2418"
            width="16"
            height="16"
        >
          <path
              d="M857.28 344.992h-264.832c12.576-44.256 18.944-83.584 18.944-118.208 0-78.56-71.808-153.792-140.544-143.808-60.608 8.8-89.536 59.904-89.536 125.536v59.296c0 76.064-58.208 140.928-132.224 148.064l-117.728-0.192A67.36 67.36 0 0 0 64 483.04V872c0 37.216 30.144 67.36 67.36 67.36h652.192a102.72 102.72 0 0 0 100.928-83.584l73.728-388.96a102.72 102.72 0 0 0-100.928-121.824zM128 872V483.04c0-1.856 1.504-3.36 3.36-3.36H208v395.68H131.36A3.36 3.36 0 0 1 128 872z m767.328-417.088l-73.728 388.96a38.72 38.72 0 0 1-38.048 31.488H272V476.864a213.312 213.312 0 0 0 173.312-209.088V208.512c0-37.568 12.064-58.912 34.72-62.176 27.04-3.936 67.36 38.336 67.36 80.48 0 37.312-9.504 84-28.864 139.712a32 32 0 0 0 30.24 42.496h308.512a38.72 38.72 0 0 1 38.048 45.888z"
              p-id="2419"
              fill="#d81e06"
          ></path>
        </svg>
        <span>{{ hospitalStore.hospitalInfo.hospital?.param.hostypeString }}</span>
      </div>
    </div>
    <!-- 展示内容区域 -->
    <div class="content">
      <div class="left">
        <img
            :src="`data:image/jpeg;base64,` + hospitalStore.hospitalInfo.hospital?.logoData"
            alt=""
        />
      </div>
      <div class="right">
        <div class="gua_level">挂号规则</div>
        <div class="time">
          <span class="right_min_title">预约周期:</span>10天&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <span class="right_min_title">
          放号时间:</span> {{
            hospitalStore.hospitalInfo.bookingRule?.releaseTime
          }} &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="right_min_title">停挂时间:</span>{{
            hospitalStore.hospitalInfo.bookingRule?.stopTime }}
        </div>
        <div class="address">
          <span class="right_min_title">具体位置:</span>{{ hospitalStore.hospitalInfo.hospital?.param.fullAddress }}
        </div>
        <div class="route"><span class="right_min_title">具体路线:</span>{{ hospitalStore.hospitalInfo.hospital?.route
          }}</div>
        <div class="releasetime">
          <span class="right_min_title">退号时间:</span>就诊前一工作日{{
            hospitalStore.hospitalInfo.bookingRule?.quitTime
          }}前取消
        </div>
        <div class="rule">预约挂号规则</div>
        <div
            class="ruleInfo"
            v-for="(item, index) in hospitalStore.hospitalInfo.bookingRule?.rule"
            :key="index"
        >
          {{ item }}
        </div>
      </div>

    </div>
    <div class="deparment">
      <div class="menu">
        <el-menu
            default-active="1"
            @select="selectMenu"
        >
          <el-menu-item :index="item.depcode" v-for="(item,index) in Department.Department"
          >
             <div >{{item.depname}}</div>
          </el-menu-item>

        </el-menu>
      </div>
      <div class="content">
        <div class="part" v-for="(item,index) in Department.Department">
          <div class="part_title" :id="item.depcode">
           <div >{{item.depname}}</div>
          </div>
          <div class="part_content">
               <div class="part_content_item" v-for="(part_item,index) in item.children" :key="index"
                    @click="goOfficialRegister(part_item)">
                <div>{{part_item.depname}}</div>
               </div>
          </div>
        </div>
      </div>

    </div>

  </div>
</template>

<script setup lang="ts">
//引入医院详细仓库
import {useHospitalDetail} from '@/stores/modules/hospitalDetail.ts'
const hospitalStore=useHospitalDetail()
// 引入科室仓库
import {useHospitalDepartment} from "@/stores/modules/hospitalDepartment.ts";
const Department=useHospitalDepartment()
import {useRoute,useRouter} from "vue-router";
const route=useRoute()
const router=useRouter()


// 进入正式挂号
const goOfficialRegister=(part_item:object)=>{
   router.push({
     path:'register_step1',
     query:{
       hoscode:route.query.hoscode,
       depcode:part_item.depcode
     }
   })
}

const selectMenu=(index)=>{
  const anchor = document.getElementById(index);
  if (anchor) {
    anchor.scrollIntoView(
        {
          behavior: 'smooth' ,
          block:"center",
        },

    );
  }

}






</script>

<style scoped lang="scss">
a{
  text-decoration: none; /* 去除默认的下划线 */
  outline: none; /* 去除旧版浏览器的点击后的外虚线框 */
  color: #000; /* 去除默认的颜色和点击后变化的颜色 */
}
.register {
  .top {
    display: flex;
    align-items: center;
    .title {
      color: #333;
      font-size: 20px;
      font-weight: 700;
      margin-right: 15px;
    }
    .level {
      display: flex;
      align-items: center;
      color: #7f7f7f;
      margin-left: 10px;
      height: 40px;
      text-align: center;
      line-height: 40px;
      span {
          margin-left: 5px;
        font-size: 14px;
      }
    }
  }
  .content {
    display: flex;
    margin-top: 20px;
    .left {
      width: 100px;
      img {
        width: 100px;
        height: 100px;
        border-radius: 50%;
      }
    }
    .right {
      flex: 1;
      font-size: 16px;
      margin-left: 20px;
      .gua_level{
        margin: 20px 0px;
      }


      .right_min_title{
        font-weight: bold;
        font-size: 14px;
      }
      .route{
        line-height: 25px;
        margin-top: 10px;
        font-size: 14px;
        color: #7f7f7f;
      }
    .time,
    .address,
      .releasetime,
      .ruleInfo {
        margin-top: 10px;
        font-size: 14px;
        color: #7f7f7f;
      }
      .rule {
        margin: 20px 0px;
      }
    }
  }
  .deparment {
    width: 100%;
    display: flex;
    margin-top: 20px;

    .content{
      display: flex;
      flex-wrap: wrap;
      width: 100%;
      height: 900px;
      overflow: scroll;
      &::-webkit-scrollbar{display:none;}//隐藏滚动条
      .part{
        width: 100%;
        -webkit-font-smoothing: antialiased;
        -webkit-tap-highlight-color: transparent;
        font-size: 14px;
        color: #666;
        font-family: Helvetica Neue,Helvetica,Arial,PingFang SC,Hiragino Sans GB,Heiti SC,Microsoft YaHei,WenQuanYi Micro Hei,sans-serif;
        margin: 0;
        box-sizing: border-box;
        padding: 20px 0 20px 30px;
        border-radius: 4px;
        margin-top: 0;

        .part_title{
          display: flex;
          align-items: center;
          background-color: #FAFAFA;
          margin-bottom: 20px;
          width: 100%;
          height: 40px;
          color: #333;
          font-size: 16px;
          font-weight: bold;

        }
        .part_content{
          -webkit-font-smoothing: antialiased;
          -webkit-tap-highlight-color: transparent;
          font-size: 14px;
          color: #666;
          font-family: Helvetica Neue,Helvetica,Arial,PingFang SC,Hiragino Sans GB,Heiti SC,Microsoft YaHei,WenQuanYi Micro Hei,sans-serif;
          margin: 0;
          padding: 0;
          box-sizing: border-box;
          display: flex;
          flex-wrap: wrap;
          margin-top: 10px;
          .part_content_item{
            width: 30%;
            height: 50px;
            font-size: 14px;
            color: grey;
            cursor: pointer;
            display: flex;
            justify-content: flex-start;
            align-items: center;
            padding-left: 60px;
            &:hover{
              background-color: #F7F7F7;
            }

          }
        }
      }
    }

  }

}
</style>